this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,n,a,i,o){"use strict";function s(e){var t=e.deltaX;var n=-1*e.deltaY;if(o.Type.isUndefined(t)||o.Type.isUndefined(n)){t=-1*e.wheelDeltaX/6;n=e.wheelDeltaY/6}if(e.deltaMode===1){t*=10;n*=10}if(Number.isNaN(t)&&Number.isNaN(n)){t=0;n=e.wheelDelta}return{x:t,y:n}}function l(e){var t=300;return Math.min(400/500*e,t)}function r(e,t){return new Promise((function(n){var a=0;var i=0;if(t){var s=20;var r=Math.max(parseInt(o.Dom.style(t,"margin-top")),s);var d=e.scrollTop;if(!(e instanceof HTMLIFrameElement)){a=t.offsetTop-(e.offsetTop||0)-r}else{d=e.contentWindow.scrollY;a=BX.pos(t).top-r-100}i=l(Math.abs(a-d));var u=Math.max(d,0);var c=Math.max(a,0);if(u!==c){new BX.easing({duration:i,start:{scrollTop:u},finish:{scrollTop:c},step:function t(n){if(!(e instanceof HTMLIFrameElement)){e.scrollTop=n.scrollTop}else{e.contentWindow.scrollTo(0,Math.max(n.scrollTop,0))}}}).animate();setTimeout(n,i)}else{n()}}else{n()}}))}var d,u,c,h,v,b,p,f;var y=function(e){babelHelpers.inherits(t,e);babelHelpers.createClass(t,null,[{key:"createOverlay",value:function e(){return o.Tag.render(d||(d=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-overlay landing-ui-hide" data-is-shown="false" hidden></div>\n\t\t'])))}},{key:"createHeader",value:function e(){return o.Tag.render(u||(u=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-element landing-ui-panel-content-header"></div>\n\t\t'])))}},{key:"createTitle",value:function e(){return o.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-title"></div>\n\t\t'])))}},{key:"createBody",value:function e(){return o.Tag.render(h||(h=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-element landing-ui-panel-content-body"></div>\n\t\t'])))}},{key:"createSidebar",value:function e(){return o.Tag.render(v||(v=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-body-sidebar"></div>\n\t\t'])))}},{key:"createContent",value:function e(){return o.Tag.render(b||(b=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-body-content"></div>\n\t\t'])))}},{key:"createFooter",value:function e(){return o.Tag.render(p||(p=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-panel-content-element landing-ui-panel-content-footer"></div>\n\t\t'])))}},{key:"calculateTransitionDuration",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return l(t)}},{key:"scrollTo",value:function e(t,n){return r(t,n)}},{key:"getDeltaFromEvent",value:function e(t){return s(t)}}]);function t(e){var n;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};babelHelpers.classCallCheck(this,t);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e,a));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"adjustActionsPanels",true);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(n),"closeByEsc",true);o.Dom.addClass(n.layout,"landing-ui-panel-content");n.data=Object.freeze(a);n.overlay=t.createOverlay();n.header=t.createHeader();n.title=t.createTitle();n.body=t.createBody();n.footer=t.createFooter();n.sidebar=t.createSidebar();n.content=t.createContent();n.closeButton=new BX.Landing.UI.Button.BaseButton("close",{className:"landing-ui-panel-content-close",onClick:function e(){void n.hide();n.emit("onCancel");BX.onCustomEvent(babelHelpers.assertThisInitialized(n),"BX.Landing.Block:onBlockEditClose",[])},attrs:{title:BX.Landing.Loc.getMessage("LANDING_TITLE_OF_SLIDER_CLOSE")}});if(o.Type.isBoolean(a.closeByEsc)){n.closeByEsc=a.closeByEsc}n.forms=new BX.Landing.UI.Collection.FormCollection;n.buttons=new BX.Landing.UI.Collection.ButtonCollection;n.sidebarButtons=new BX.Landing.UI.Collection.ButtonCollection;n.wheelEventName=o.Type.isNil(window.onwheel)?window.onwheel:window.onmousewheel;n.onMouseWheel=n.onMouseWheel.bind(babelHelpers.assertThisInitialized(n));n.onMouseEnter=n.onMouseEnter.bind(babelHelpers.assertThisInitialized(n));n.onMouseLeave=n.onMouseLeave.bind(babelHelpers.assertThisInitialized(n));o.Dom.removeClass(n.layout,"landing-ui-hide");o.Dom.addClass(n.overlay,"landing-ui-hide");o.Dom.append(n.sidebar,n.body);o.Dom.append(n.content,n.body);o.Dom.append(n.header,n.layout);o.Dom.append(n.title,n.header);o.Dom.append(n.body,n.layout);o.Dom.append(n.footer,n.layout);o.Dom.append(n.closeButton.layout,n.layout);if(o.Type.isString(a.className)){o.Dom.addClass(n.layout,[a.className,"".concat(a.className,"-overlay")])}if(o.Type.isString(a.subTitle)&&a.subTitle!==""){n.subTitle=o.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-panel-content-subtitle">',"</div>\n\t\t\t"])),a.subTitle);o.Dom.append(n.subTitle,n.header);o.Dom.addClass(n.layout,"landing-ui-panel-content-with-subtitle")}if(n.data.showFromRight===true){n.setLayoutClass("landing-ui-panel-show-from-right")}n.init();o.Event.bind(window.top,"keydown",n.onKeyDown.bind(babelHelpers.assertThisInitialized(n)));BX.Landing.PageObject.getEditorWindow();if(n.data.scrollAnimation){n.scrollObserver=new IntersectionObserver(n.onIntersecting.bind(babelHelpers.assertThisInitialized(n)))}n.checkReadyToSave=n.checkReadyToSave.bind(babelHelpers.assertThisInitialized(n));return n}babelHelpers.createClass(t,[{key:"init",value:function e(){var t=this;o.Dom.append(this.overlay,window.parent.document.body);o.Event.bind(this.overlay,"click",(function(){t.emit("onCancel");void t.hide()}));o.Event.bind(this.layout,"mouseenter",this.onMouseEnter);o.Event.bind(this.layout,"mouseleave",this.onMouseLeave);o.Event.bind(this.content,"mouseenter",this.onMouseEnter);o.Event.bind(this.content,"mouseleave",this.onMouseLeave);o.Event.bind(this.sidebar,"mouseenter",this.onMouseEnter);o.Event.bind(this.sidebar,"mouseleave",this.onMouseLeave);o.Event.bind(this.header,"mouseenter",this.onMouseEnter);o.Event.bind(this.header,"mouseleave",this.onMouseLeave);o.Event.bind(this.footer,"mouseenter",this.onMouseEnter);o.Event.bind(this.footer,"mouseleave",this.onMouseLeave);if("title"in this.data){this.setTitle(this.data.title)}if("footer"in this.data){if(o.Type.isArray(this.data.footer)){this.data.footer.forEach((function(e){if(e instanceof BX.Landing.UI.Button.BaseButton){t.appendFooterButton(e)}if(o.Type.isDomNode(e)){o.Dom.append(e,t.footer)}}))}}}},{key:"onIntersecting",value:function e(t){t.forEach((function(e){if(e.isIntersecting){o.Dom.removeClass(e.target,"landing-ui-is-not-visible");o.Dom.addClass(e.target,"landing-ui-is-visible")}else{o.Dom.addClass(e.target,"landing-ui-is-not-visible");o.Dom.removeClass(e.target,"landing-ui-is-visible")}}))}},{key:"onKeyDown",value:function e(t){if(this.closeByEsc&&t.keyCode===27){this.emit("onCancel");void this.hide()}}},{key:"onMouseEnter",value:function e(t){t.stopPropagation();o.Event.bind(this.layout,this.wheelEventName,this.onMouseWheel);o.Event.bind(this.layout,"touchmove",this.onMouseWheel);if(this.sidebar.contains(t.target)||this.content.contains(t.target)||this.header.contains(t.target)||this.footer.contains(t.target)||this.right&&this.right.contains(t.target)){this.scrollTarget=t.currentTarget}}},{key:"onMouseLeave",value:function e(t){t.stopPropagation();BX.unbind(this.layout,this.wheelEventName,this.onMouseWheel);BX.unbind(this.layout,"touchmove",this.onMouseWheel)}},{key:"onMouseWheel",value:function e(n){var a=this;n.preventDefault();n.stopPropagation();var i=t.getDeltaFromEvent(n);var o=this.scrollTarget.scrollTop;requestAnimationFrame((function(){a.scrollTarget.scrollTop=o-i.y}))}},{key:"scrollTo",value:function e(n){void t.scrollTo(this.content,n)}},{key:"isShown",value:function e(){return this.state==="shown"}},{key:"shouldAdjustActionsPanels",value:function e(){return this.adjustActionsPanels}},{key:"show",value:function e(t){var n=this;if(!this.isShown()){if(this.shouldAdjustActionsPanels()){o.Dom.addClass(document.body,"landing-ui-hide-action-panels")}o.Dom.addClass(document.body,"landing-ui-action-panels-disable-scrollbar");void BX.Landing.Utils.Show(this.overlay);return BX.Landing.Utils.Show(this.layout).then((function(){n.state="shown"}))}return Promise.resolve(true)}},{key:"hide",value:function e(){var t=this;if(this.isShown()){if(this.shouldAdjustActionsPanels()){o.Dom.removeClass(document.body,"landing-ui-hide-action-panels")}o.Dom.removeClass(document.body,"landing-ui-action-panels-disable-scrollbar");void BX.Landing.Utils.Hide(this.overlay);return BX.Landing.Utils.Hide(this.layout).then((function(){t.state="hidden"}))}return Promise.resolve(true)}},{key:"appendForm",value:function e(t){this.forms.add(t);o.Dom.append(t.getNode(),this.content)}},{key:"appendCard",value:function e(t){if(this.data.scrollAnimation){o.Dom.addClass(t.layout,"landing-ui-is-not-visible");this.scrollObserver.observe(t.layout)}o.Dom.append(t.layout,this.content)}},{key:"clear",value:function e(){this.clearContent();this.clearSidebar();this.forms.clear()}},{key:"clearContent",value:function e(){o.Dom.clean(this.content)}},{key:"clearSidebar",value:function e(){o.Dom.clean(this.sidebar);this.sidebarButtons=new BX.Landing.UI.Collection.ButtonCollection}},{key:"setTitle",value:function e(t){this.title.innerHTML=t}},{key:"appendFooterButton",value:function e(t){this.buttons.add(t);o.Dom.append(t.layout,this.footer)}},{key:"appendSidebarButton",value:function e(t){this.sidebarButtons.add(t);o.Dom.append(t.layout,this.sidebar)}},{key:"setOverlayClass",value:function e(t){o.Dom.addClass(this.overlay,t)}},{key:"renderTo",value:function e(n){babelHelpers.get(babelHelpers.getPrototypeOf(t.prototype),"renderTo",this).call(this,n);o.Dom.append(this.overlay,n)}},{key:"checkReadyToSave",value:function e(){var t=this;var n=true;this.forms.forEach((function(e){e.fields.forEach((function(e){if(e.readyToSave===false){n=false}if(!e.getListeners("onChangeReadyToSave").has(t.checkReadyToSave)){e.subscribe("onChangeReadyToSave",t.checkReadyToSave)}}))}));n?this.enableSave():this.disableSave()}},{key:"disableSave",value:function e(){var t=this.buttons.get("save_block_content");if(t){t.disable()}}},{key:"enableSave",value:function e(){var t=this.buttons.get("save_block_content");if(t){t.enable()}}}]);return t}(i.BasePanel);e.Content=y})(this.BX.Landing.UI.Panel=this.BX.Landing.UI.Panel||{},BX,BX,BX.Landing,BX.Landing.UI.Panel,BX);
//# sourceMappingURL=content.bundle.map.js